package org.yangyang.top100.P448FindAllNumbersDisappearedinanArray;

import java.util.ArrayList;
import java.util.HashMap;

import java.util.LinkedList;
import java.util.List;

/**
 * 2020-06-29
 * 输入:
 * [4,3,2,7,8,2,3,1]
 * 输出:
 * [5,6]
 */
public class Solution {
    public List<Integer> findDisappearedNumbers(int[] nums) {
        //哈希表
        HashMap<Integer,Boolean> map=new HashMap<Integer,Boolean>();
        for(int i=0;i<nums.length;i++){
            map.put(nums[i],true);
        }
        List<Integer> list=new LinkedList<>();
        for(int i=1;i<=nums.length;i++){
            if(!map.containsKey(i)){
                list.add(i);
            }
        }
        return list;
    }
}
